﻿using Nancy.Hosting.Self;
using Nancy.Swagger;
using System;
using System.Collections.Generic;

namespace NancyTest
{
    internal class Program
    {
        static void Main(string[] args)
        {
            Dictionary<string, string> languageDict = new Dictionary<string, string>()
            {
                { "返回对象","RetObject" },
                { "返回数据","RetData" },
                { "返回状态","RetState" },
                { "返回消息","RetMessage" },
                { "获得XX数据","GetXXData" },
                { "获得XX数据Tag","GetXXDataTag" },
                { "获得某用户的数据","GetAnyUser'sData" },
                { "获得某用户的数据Tag","GetAnyUser'sDataTag" },
                { "上传数据","UploadData" },
                { "上传XX数据","UploadXXData" },
                { "上传XX数据Tag","UploadXXDataTag" },
                { "上传XXX数据","UploadXXXData" },
                { "上传XXX数据Tag","UploadXXXDataTag" },
                { "用户名","UserName"},
                { "姓名","Name" },
                { "年龄","Age" },
                { "上传文件","UploadFile" },
                { "文件上传","UploadFile" },
                { "上传文件Tag","UploadFileTag" },
                { "文件","File"},
                { "JSON数据上传","Upload Json Data"}
            };
            SwaggerConfig.SetLanguage(languageDict);

            Start();
            Console.WriteLine("Web服务已启动");
            Console.ReadLine();
            Stop();
            Console.WriteLine("Web服务已关闭");
        }
        private static NancyHost host;
        public static void Start()
        {
            host = new NancyHost(new Uri("http://localhost:80"));
            host.Start();
        }

        public static void Stop()
        {
            host.Stop();
        }
    }
}
